$(function () {

    $(".btn-primary").click(function (event) {
        event.preventDefault(); 
        let username = $(".user").val()
        let password = $(".passw").val()
        let introduce = $(".introduce").val()
        $.post(
            "api/addUser",
            {
                userName:username,
                userPassword:password,
                desc:introduce
            },
            function(data){
                if(data.userName===username){
                    alert("注册成功！")
                    window.location.href="./login.html"
                }else{
                    alert("注册失败！")
                }
            }
        )

    })
})
